3.1454 \(\int \csc ^2(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx\)

Optimal. Leaf size=59 \[ \frac {\left (a^2+b^2\right ) \tan (c+d x)}{d}-\frac {a^2 \cot (c+d x)}{d}+\frac {2 a b \sec (c+d x)}{d}-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d} \]

[Out]

-2*a*b*arctanh(cos(d*x+c))/d-a^2*cot(d*x+c)/d+2*a*b*sec(d*x+c)/d+(a^2+b^2)*tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.28, antiderivative size = 59, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {2911, 2622, 321, 207, 3200, 14} \[ \frac {\left (a^2+b^2\right ) \tan (c+d x)}{d}-\frac {a^2 \cot (c+d x)}{d}+\frac {2 a b \sec (c+d x)}{d}-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d} \]

Antiderivative was successfully verified.

[In]

Int[Csc[c + d*x]^2*Sec[c + d*x]^2*(a + b*Sin[c + d*x])^2,x]

[Out]

(-2*a*b*ArcTanh[Cos[c + d*x]])/d - (a^2*Cot[c + d*x])/d + (2*a*b*Sec[c + d*x])/d + ((a^2 + b^2)*Tan[c + d*x])/
d

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 207

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTanh[(Rt[b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 321

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(c^(n - 1)*(c*x)^(m - n + 1)*(a + b*x^n
)^(p + 1))/(b*(m + n*p + 1)), x] - Dist[(a*c^n*(m - n + 1))/(b*(m + n*p + 1)), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2622

Int[csc[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> Dist[1/(f*a^n), Subst[Int
[x^(m + n - 1)/(-1 + x^2/a^2)^((n + 1)/2), x], x, a*Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n
 + 1)/2] &&  !(IntegerQ[(m + 1)/2] && LtQ[0, m, n])

Rule 2911

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) + (b_.)*sin[(e_.) + (f_.)*
(x_)])^2, x_Symbol] :> Dist[(2*a*b)/d, Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n + 1), x], x] + Int[(g*Cos[e
+ f*x])^p*(d*Sin[e + f*x])^n*(a^2 + b^2*Sin[e + f*x]^2), x] /; FreeQ[{a, b, d, e, f, g, n, p}, x] && NeQ[a^2 -
 b^2, 0]

Rule 3200

Int[cos[(e_.) + (f_.)*(x_)]^(m_)*sin[(e_.) + (f_.)*(x_)]^(n_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.),
x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff^(n + 1)/f, Subst[Int[(x^n*(a + (a + b)*ff^2*x^2
)^p)/(1 + ff^2*x^2)^((m + n)/2 + p + 1), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[m/
2] && IntegerQ[n/2] && IntegerQ[p]

Rubi steps

\begin {align*} \int \csc ^2(c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=(2 a b) \int \csc (c+d x) \sec ^2(c+d x) \, dx+\int \csc ^2(c+d x) \sec ^2(c+d x) \left (a^2+b^2 \sin ^2(c+d x)\right ) \, dx\\ &=\frac {\operatorname {Subst}\left (\int \frac {a^2+\left (a^2+b^2\right ) x^2}{x^2} \, dx,x,\tan (c+d x)\right )}{d}+\frac {(2 a b) \operatorname {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{d}\\ &=\frac {2 a b \sec (c+d x)}{d}+\frac {\operatorname {Subst}\left (\int \left (a^2 \left (1+\frac {b^2}{a^2}\right )+\frac {a^2}{x^2}\right ) \, dx,x,\tan (c+d x)\right )}{d}+\frac {(2 a b) \operatorname {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{d}\\ &=-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}-\frac {a^2 \cot (c+d x)}{d}+\frac {2 a b \sec (c+d x)}{d}+\frac {\left (a^2+b^2\right ) \tan (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.35, size = 102, normalized size = 1.73 \[ -\frac {\csc \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {1}{2} (c+d x)\right ) \sec (c+d x) \left (\left (2 a^2+b^2\right ) \cos (2 (c+d x))-b \left (4 a \sin (c+d x)-2 a \sin (2 (c+d x)) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+b\right )\right )}{4 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[c + d*x]^2*Sec[c + d*x]^2*(a + b*Sin[c + d*x])^2,x]

[Out]

-1/4*(Csc[(c + d*x)/2]*Sec[(c + d*x)/2]*Sec[c + d*x]*((2*a^2 + b^2)*Cos[2*(c + d*x)] - b*(b + 4*a*Sin[c + d*x]
 - 2*a*(Log[Cos[(c + d*x)/2]] - Log[Sin[(c + d*x)/2]])*Sin[2*(c + d*x)])))/d

________________________________________________________________________________________

fricas [A]  time = 0.45, size = 113, normalized size = 1.92 \[ -\frac {a b \cos \left (d x + c\right ) \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - a b \cos \left (d x + c\right ) \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + {\left (2 \, a^{2} + b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}{d \cos \left (d x + c\right ) \sin \left (d x + c\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)^2*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-(a*b*cos(d*x + c)*log(1/2*cos(d*x + c) + 1/2)*sin(d*x + c) - a*b*cos(d*x + c)*log(-1/2*cos(d*x + c) + 1/2)*si
n(d*x + c) + (2*a^2 + b^2)*cos(d*x + c)^2 - 2*a*b*sin(d*x + c) - a^2 - b^2)/(d*cos(d*x + c)*sin(d*x + c))

________________________________________________________________________________________

giac [B]  time = 0.21, size = 128, normalized size = 2.17 \[ \frac {12 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + 3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {4 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 15 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 12 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 20 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{6 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)^2*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

1/6*(12*a*b*log(abs(tan(1/2*d*x + 1/2*c))) + 3*a^2*tan(1/2*d*x + 1/2*c) - (4*a*b*tan(1/2*d*x + 1/2*c)^3 + 15*a
^2*tan(1/2*d*x + 1/2*c)^2 + 12*b^2*tan(1/2*d*x + 1/2*c)^2 + 20*a*b*tan(1/2*d*x + 1/2*c) - 3*a^2)/(tan(1/2*d*x
+ 1/2*c)^3 - tan(1/2*d*x + 1/2*c)))/d

________________________________________________________________________________________

maple [A]  time = 0.60, size = 90, normalized size = 1.53 \[ \frac {a^{2}}{d \sin \left (d x +c \right ) \cos \left (d x +c \right )}-\frac {2 a^{2} \cot \left (d x +c \right )}{d}+\frac {2 a b}{d \cos \left (d x +c \right )}+\frac {2 a b \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{d}+\frac {b^{2} \tan \left (d x +c \right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(d*x+c)^2*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x)

[Out]

1/d*a^2/sin(d*x+c)/cos(d*x+c)-2*a^2*cot(d*x+c)/d+2/d*a*b/cos(d*x+c)+2/d*a*b*ln(csc(d*x+c)-cot(d*x+c))+b^2*tan(
d*x+c)/d

________________________________________________________________________________________

maxima [A]  time = 0.45, size = 71, normalized size = 1.20 \[ \frac {a b {\left (\frac {2}{\cos \left (d x + c\right )} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} - a^{2} {\left (\frac {1}{\tan \left (d x + c\right )} - \tan \left (d x + c\right )\right )} + b^{2} \tan \left (d x + c\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)^2*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

(a*b*(2/cos(d*x + c) - log(cos(d*x + c) + 1) + log(cos(d*x + c) - 1)) - a^2*(1/tan(d*x + c) - tan(d*x + c)) +
b^2*tan(d*x + c))/d

________________________________________________________________________________________

mupad [B]  time = 11.87, size = 108, normalized size = 1.83 \[ \frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (5\,a^2+4\,b^2\right )-a^2+8\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\right )}+\frac {a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d}+\frac {2\,a\,b\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*sin(c + d*x))^2/(cos(c + d*x)^2*sin(c + d*x)^2),x)

[Out]

(tan(c/2 + (d*x)/2)^2*(5*a^2 + 4*b^2) - a^2 + 8*a*b*tan(c/2 + (d*x)/2))/(d*(2*tan(c/2 + (d*x)/2) - 2*tan(c/2 +
 (d*x)/2)^3)) + (a^2*tan(c/2 + (d*x)/2))/(2*d) + (2*a*b*log(tan(c/2 + (d*x)/2)))/d

________________________________________________________________________________________

sympy [F(-1)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)**2*sec(d*x+c)**2*(a+b*sin(d*x+c))**2,x)

[Out]

Timed out

________________________________________________________________________________________